package model.altarica_fields;

import java.util.LinkedList;
import java.util.List;

import math.Expression;

public class Trans {

	private Expression guard;
	private List<Event> e;
	private final List<UpdateExpression>  u;
	
	public Trans(Expression guard, List<Event> e, List<UpdateExpression> u) {
		
		this.guard = guard;
		
		this.e = new LinkedList<Event>();
		
		this.e = e;
		
		this.u = u;
		
	}
	
	public Expression getGuard() {
		
		return this.guard;
	}
	
	public List<Event> getEvent() {
		
		return this.e;
	}
	
	public void addEvent(Event e) {
		
		this.e.add(e);
	}
	
	public void setEvents(List<Event> e) {
		
		this.e = e;
	}
	
	public List<UpdateExpression> getUpdates() {
		
		return this.u;
	}
	
	public String toString() {
		
		String str = guard + " |- ";
		
		
		for (Event ev : e) {
			
			str += ev.getId() + ", ";
		}
		
		str = str.substring(0, str.length() - 2);
		
		str += " -> ";
		
		if (u.isEmpty() == false) {
		
			for (UpdateExpression up : u) {
			
				str += up + ", ";
			}
		
			str = str.substring(0, str.length() - 2);
		}
		
		
		return str;
	}
}
